#include <iostream>
#include <memory>

class Test
{
public:
    Test(){}
    Test(int a):a(std::make_shared<int>(a)){}
    // Test(int a, char b):a(a), b(b){}

    // 委托构造：用已有的构造函数构建新的构造函数
    Test(int a, char b):Test(a)
    {
        this->b = b;
    }
    Test(int a, char b, double c):Test(a, b)
    {
        this->c = c;
    }
    
private:
    std::shared_ptr<int> a;
    char b;
    double c;
};

class Derived : public Test
{
public:
    // Derived(int a):Test(a){}
    // Derived(int a, char b):Test(a, b){}
    // Derived(int a, char b, double c):Test(a, b, c){}

    // 继承构造：继承父类的构造函数
    // 前提：子类没有多余的变量定义
    using Test::Test;
};

int main()
{
    Derived d();
    return 0;
}